package com.ego.item.api;

import com.ego.item.pojo.Category;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@RequestMapping("category")
public interface CategoryApi {
    @GetMapping("list")
    ResponseEntity<List<Category>>
    queryCategoryListByPid(@RequestParam(name = "pid", defaultValue = "0") Long pid);

    /**
     * 根据商品分类id查询名称
     *
     * @param ids 要查询的分类id集合
     * @return 多个名称的集合
     */
    @GetMapping("names")
    ResponseEntity<List<String>> queryNameByIds(@RequestParam("ids") List<Long> ids);


    @GetMapping("/list/ids")
    List<Category> queryCategoryListByIds(@RequestParam(value = "ids",required = false) List<Long> categoryIds);
}
